package cn.wolfcode.MyEnum;

import lombok.Getter;

@Getter
public enum ConsumptionReportEnum {
    CONSUME("部门", "b.name"),
    YEAR("年", "DATE_FORMAT(c.pay_time,'%Y')"),
    MONTH("月", "DATE_FORMAT(c.pay_time,'%Y-%m')"),
    DAY("日", "DATE_FORMAT(c.pay_time,'%Y-%m-%d')");

    private String name;
    private String value;

    ConsumptionReportEnum(String name,String value) {
        this.name = name;
        this.value = value;
    }

    //提供一个根据value 获取名字的方法
    public static String findName(String value) {
        ConsumptionReportEnum[] values = ConsumptionReportEnum.values();
        for (ConsumptionReportEnum a : values) {
            if (a.getValue().equals(value)) {
                return a.getName();
            }
        }
        return null;
    }
}
